import os
import sys
from threading import Thread
from multiprocessing import Process
import time

sys.path.insert(0,"..")
import plugin
import util

#services = plugin.ParentPlugin(__file__)
PLUGIN_FOLDER = "service_plugins"
PLUGIN_FOLDER_PATH = os.path.join(os.path.dirname(__file__),PLUGIN_FOLDER)
PLUGIN_NAME = "iservices"

class IServices(util.ParentPlugin):
    def stop(self,args=None):
      self.post((util.QUIT,args))

def start(server,parent):
    iservices = IServices(parent,__file__,PLUGIN_NAME)
    server.connect(iservices,PLUGIN_NAME)
    util.load_plugins(server,iservices,PLUGIN_FOLDER_PATH,container = parent)
    plugin.update_state(PLUGIN_NAME,plugin.STARTED)
